{extend name="layout/layout" /}

{block name="header"}
	<header class="mui-bar mui-bar-nav">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		<h1 class="mui-title">{$title?$title:'商城'}</h1>
	</header>
{/block}

{block name="style"}
	<style>

	</style>
{/block}

{block name="main"}
	<div class="setting" v-cloak>
		<div class="menu">
			<ul class="mui-table-view">
			    <li class="mui-table-view-cell">
			        <a class="mui-navigate-right">
			        	<span class="mui-icon iconfont icon-weibiaoti2fuzhi12 text-danger"></span>
			        	个人资料
			        </a>
			    </li>
			    <li class="mui-table-view-cell">
			        <a class="mui-navigate-right" href="{:url('user/changePassword')}">
			        	<span class="mui-icon iconfont icon-mima text-danger"></span>
			        	修改登录密码
			        </a>
			    </li>
			    <li class="mui-table-view-cell">
			        <a class="mui-navigate-right" href="{:url('user/changePayPassword')}">
			        	<span class="mui-icon iconfont icon-mima text-danger"></span>
			        	修改支付密码
			        </a>
			    </li>
			    <li class="mui-table-view-cell" >
			        <a class="mui-navigate-right" href="{:url('address/index')}">
			        	<span class="mui-icon iconfont icon-dizhi-01 text-danger"></span>
			        	收货地址
			        </a>
			    </li>
			    <li class="mui-table-view-cell">
			        <a class="mui-navigate-right"  href="{:url('article/detail', ['id' => 3])}">
			        	<span class="mui-icon iconfont icon-guanyuwomen text-danger"></span>
			        	关于我们
			        </a>
			    </li>

			    
			</ul>	
		</div>

		<div class="mui-btn mui-btn-block mui-btn-theme" @tap="logout()">
	        退出当前帐号
	    </div>
	</div>
{/block}

{block name="script"}
	<script>


		var myVue = new Vue({
			el:'.setting',
			data:{
				userInfo:[]
			},
			mounted: function(){
				if(token){
					this.token = token;
					console.log(this.token);
				}

				console.log(localStorage.getItem('token'));
				console.log(localStorage.getItem('merid'));

			},
			methods: {
				login:function(){
					location.href = '/mobile/user/login';
				},
				logout: function(){
					var that = this;
					var url =  "{:url('user/logout')}";
					this.$http.post(url,{token:that.token},{emulateJSON : true}).then(function(res){
						this.login();
					},function(error){
						mui.toast(error.body.msg);
					});
					
				}
			}
		});
	</script>
{/block}